package br.com.afi.util.validator.test;

import org.junit.Assert;
import org.junit.Test;

import br.com.afi.util.hibernate.validator.NumberStrValidator;

public class NumberStrTestCase
{
	@Test
	public void integerTest()
	{
		final NumberStrValidator validator = new NumberStrValidator( 8, 0, false );
		Assert.assertTrue( validator.isValid( "-3100", null ) );
	}
	@Test
	public void notIntegerTest()
	{
		final NumberStrValidator validator = new NumberStrValidator( 8, 0, false );
		Assert.assertFalse( validator.isValid( "-3100,0", null ) );
	}
	@Test
	public void decimalTest()
	{
		final NumberStrValidator validator = new NumberStrValidator( 8, 2, false );
		Assert.assertTrue( validator.isValid( "31,22", null ) );
	}
	@Test
	public void notDecimalTest()
	{
		final NumberStrValidator validator = new NumberStrValidator( 8, 2, true );
		Assert.assertFalse( validator.isValid( "3100", null ) );
	}
}
